<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
<link type="text/css" rel="stylesheet" href="css/table.css">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/openwindow.js"></script>
<script type="text/javascript" src="js/file.js"></script>
<script type="text/javascript" src="js/flow.js"></script>
<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<style type="text/css">
body,td,th {
	background-color: white;
	font-family: "宋体";
	font-size: 12px;
}

.sendtd {
	border-bottom: #F00 double 1px
}

.ztable {
	margin: 15px 0 15px 0
}
</style>
<script type="text/javascript">
	function saveText(val) {
		$("#contentid").val(val);
	}
	function nextstep(id, user) {
		var flag = validateReceive();
		if (!flag) {
			return;
		}
		var table = $("#filetable").find("input[type=\"checkbox\"]");
		var textIds = $("#zhengwentable").find("input[type=\"checkbox\"]");
		var fileId = "";
		var idArr = "";

		for (var i = 0; i < table.length; i++) {
			fileId += "_" + table[i].value;
		}
		for (var i = 0; i < textIds.length; i++) {
			idArr += "_" + textIds[i].value;
		}
		$("#textId").val(idArr);
		$("#fileArray").val(fileId);
		var url = "passDraft.action?nodeId=" + id + "&executors=" + user;
		enableFields(document.getElementsByTagName("input"));
		enableFields(document.getElementsByTagName("textarea"));
		enableFields(document.getElementsByTagName("select"));
		$.post(url, $("form").serialize(), function(data) {
			if (data == "success") {
				alert("操作成功");
				window.close();
				var currentPage = $("#currentPage").val();
				window.opener.page(currentPage);
			} else {
				alert("操作失败");
			}
		});
	}

	function update() {
		var url = "updateDraft.action";
		var table = $("#filetable").find("input[type=\"checkbox\"]");
		var fileId = "";
		for (var i = 0; i < table.length; i++) {
			fileId += "_" + table[i].value;
		}
		$("#fileArray").val(fileId);
		var textIds = $("#zhengwentable").find("input[type=\"checkbox\"]");
		var idArr = "";
		for (var i = 0; i < textIds.length; i++) {
			idArr += "_" + textIds[i].value;
		}
		$("#textId").val(idArr);
		$.post(url, $("form").serialize(), function(data) {
			if (data == "success") {
				alert("操作成功");
				window.close();
				var currentPage = $("#currentPage").val();
				window.opener.page(currentPage);
			} else {
				alert("操作失败");
			}
		});
	}

	function submitNextNode(id, actorType) {
		if (actorType == '2') {
			getcandidateR(id);
		} else if (actorType == '3') {
			getorguserR(id);
		} else if (actorType == '5') {
			selectUserR(id);
		} else {
			nextstep(id, '');
		}
	}

	function setValue(value, id) {
		nextstep(id, value);
	}
	function supervision() {
		$("#supervisionTag").val("1");
		alert("成功督办！");
		var user = $("#user").val();
		$("#info").html("由" + user + "督办");
	}
	function OpenComment(msg) {
		var massage = $("#" + msg).val();
		var a = massage.indexOf(" ");
		var sign = massage.substring(0, a);
		var URL = "getWorkLanAll.action?location=" + msg + "&message=" + sign;
		openWindow(encodeURI(encodeURI(URL)), 400, 300);
	}
</script>
</head>

<body
	onload="getFiles('zhengwentable','textId');getFiles('filetable','fileArray');">
	<input type="hidden" id="currentPage" value="${currentPage}">
	<form action="" method="post" name="documentForm">
		<div id="nodebutton" style="margin-left: 100px">
			<input type="button" class="button_04" onclick="supervision()"
				value="督办"> <input type='button' class='button_04'
				onclick="submitNextNode('${flowNode.id}','${flowNode.actorType}')"
				value='${flowNode.name}' />&nbsp; <input type="checkbox" value="1"
				name="message">短信提醒 <input
				style="float: right; margin-top: 10px" class="button_04"
				type="button" onclick="update();" value="保存" />&nbsp;
		</div>
		<div align="center">
			<h1 align="center" style="font-weight: bold">${document.flowName}</h1>
		</div>
		<input type="hidden" name="document.textId" id="textId"
			value="${document.textId}"> <input type="hidden"
			name="document.fileArray" id="fileArray"
			value="${document.fileArray}"> <input type="hidden"
			name="document.id" value="${document.id}"> <input
			type="hidden" name="document.draftOrg" value="${document.draftOrg}">
		<input type="hidden" name="document.draftUser"
			value="${document.draftUser}"> <input type="hidden"
			name="document.draftName" value="${document.draftName}"> <input
			type="hidden" name="document.draftStaus"
			value="${document.draftStaus}"> <input type="hidden"
			name="document.flowId" value="${document.flowId}"> <input
			type="hidden" id="contentid" name="document.contentId"
			value="${document.contentId}"> <input type="hidden"
			name="document.sfstatus" value="${document.sfstatus}"> <input
			type="hidden" name="propertyIds" value="${propertyIds}"
			id="propertyIds" /> <input type="hidden" value="${mustPropertyIds}"
			id="mustPropertyIds" />
		<table align="center" border="0" cellspacing="1" cellpadding="0"
			width="57%">
			<tr>
				<td width="60px">正文：</td>
				<td colspan="7">&nbsp;<input type="button" class="button_04"
					id="zwsc" disabled="disabled"
					onclick="file_upload('zhengwentable')" value="上传附件" /> <input
					type="button" class="button_02" onclick="fileDel('zhengwentable')"
					value="删除" />
					<table id="zhengwentable">

					</table></td>
			</tr>
			<tr>
				<td width="60px">附件：</td>
				<td colspan="7">&nbsp;<input type="button" class="button_04"
					id="fjsc" disabled="disabled" onclick="file_upload('filetable')"
					value="上传附件" /> <input type="button" class="button_02"
					onclick="fileDel('filetable')" value="删除" />
					<table id="filetable">
					</table></td>
			</tr>
		</table>
		<table align="center" style="margin-top: 10px; background: #000"
			border="0" cellspacing="1" cellpadding="0">
			<tr>
				<td width="60px">类型：</td>
				<td colspan="7"><s:select id="lx"
						onchange="typeChange(this.value)" disabled="true"
						list="departments" listKey="name" listValue="name"
						name="document.type" value="document.type" theme="simple"
						headerKey="" headerValue="--请选择--" cssStyle="width:200px"></s:select></td>
			</tr>
			<tr>
				<td width="60px">编号：</td>
				<td width="230px"><span id="fwzh" disabled="disabled"> <input
						id="postFont1" disabled="disabled" type="text"
						name="document.postFont1" value="${document.postFont1}"
						style="width: 100px;" maxlength="20" /> <s:select id="postFont2"
							disabled="true" onchange="typeChangeDate(this.value)"
							list="#{'[2007]':'2007','[2008]':'2008','[2009]':'2009','[2010]':'2010','[2011]':'2011','[2012]':'2012','[2013]':'2013','[2014]':'2014','[2015]':'2015','[2016]':'2016','[2017]':'2017','[2018]':'2018','[2019]':'2019','[2020]':'2020'}"
							name="document.postFont2" headerKey="" headerValue=""
							value="document.postFont2" theme="simple"></s:select> <input
						id="postFont3" disabled="disabled" type="text"
						name="document.postFont3" value="${document.postFont3}"
						style="width: 50px;" maxlength="20" />
				</span></td>
				<td width="70px">来文单位：</td>
				<td colspan="3" width="200px"><input id="lwdw"
					disabled="disabled" value="${document.fromDept}" maxlength="50"
					type="text" style="width: 180px;" name="document.fromDept" /> <font
					style="font-weight: bold" color="#FF0000">*</font></td>
				<td width="67px">文号：</td>
				<td><input id="wh" disabled="disabled"
					value="${document.articleNumber}" maxlength="50" type="text"
					style="width: 150px;" name="document.articleNumber" /></td>
			</tr>
			<tr>
				<td>标题：</td>
				<td colspan="7"><input id="bt" disabled="disabled"
					value="${document.title}" id="bt" maxlength="80" type="text"
					style="width: 97%;" name="document.title" /><font
					style="font-weight: bold" color="#FF0000">*</font></td>
			</tr>
			<tr>
				<td>密级：</td>
				<td><s:select id="mj" cssStyle="width:100px"
						disabled="disabled" list="#{'秘密':'秘密','机密':'机密','绝密':'绝密'}"
						name="document.mjStatu" value="document.mjStatu" theme="simple"
						headerKey="" headerValue=""></s:select></td>
				<td>份数：</td>
				<td width="63"><input id="fs" maxlength="10" type="text"
					style="width: 50px;" name="document.print"
					value="${document.print}" /></td>
				<td width="64">缓急程度：</td>
				<td width="79"><s:select id="hjcd" disabled="disabled"
						list="#{'加急':'加急','特急':'特急','特提':'特提'}" name="document.hjStatu"
						value="document.hjStatu" theme="simple" headerKey=""
						headerValue=""></s:select></td>
				<td>来文日期：</td>
				<td><input id="lwrq" name="document.printTime"
					onclick="WdatePicker()" value="${document.printTime}" class="Wdate"
					type="text" disabled="disabled"></td>
			</tr>
			<tr>
				<td height="100" align="center">
					<p>&nbsp;</p> 拟<br>
				<br> 办<br>
				<br> 意<br>
				<br> 见
					<p>&nbsp;</p>
				</td>
				<td colspan="7">
					<p>&nbsp;</p> ${document.nbyj} <textarea id="nbyj"
						disabled="disabled" name="document.nbyj"
						onclick="OpenComment('nbyj')"
						style="width: 500px; height: 120px; border: 0; overflow: hidden"></textarea>
				</td>
			</tr>
			<tr>
				<td height="100" align="center">
					<p>&nbsp;</p> 部<br>
				<br> 门<br>
				<br> 负<br>
				<br> 责<br>
				<br> 人<br>
				<br> 意<br>
				<br> 见
					<p>&nbsp;</p>
				</td>
				<td colspan="7">
					<p>&nbsp;</p> ${document.dcdb} <textarea id="dcdb"
						disabled="disabled" name="document.dcdb"
						onclick="OpenComment('dcdb')"
						style="width: 500px; height: 120px; border: 0; overflow: hidden"></textarea>
				</td>
			</tr>
			<tr>
				<td height="100" align="center">
					<p>&nbsp;</p> 局<br>
				<br> 领<br>
				<br> 导<br>
				<br> 批<br>
				<br> 示
					<p>&nbsp;</p>
				</td>
				<td colspan="7">
					<p>&nbsp;</p> ${document.ldps} <textarea id="ldps"
						disabled="disabled" name="document.ldps"
						onclick="OpenComment('ldps')"
						style="width: 500px; height: 120px; border: 0; overflow: hidden"></textarea>
				</td>
			</tr>
			<tr>
				<td height="100" align="center">
					<p>&nbsp;</p> 办<br>
				<br> 理<br>
				<br> 情<br>
				<br> 况
					<p>&nbsp;</p>
				</td>
				<td colspan="7">
					<p>&nbsp;</p> ${document.blqk } <textarea id="blqk"
						disabled="disabled" name="document.blqk"
						onclick="OpenComment('blqk')"
						style="width: 500px; height: 120px; border: 0; overflow: hidden"></textarea>
				</td>
			</tr>
			<tr>
				<td height="80" align="center">
					<p>&nbsp;</p> 备<br>
				<br> 注
					<p>&nbsp;</p>
				</td>
				<td colspan="7"><textarea id="bz" disabled="disabled"
						name="document.beizhu"
						style="width: 500px; height: 120px; border: 0; overflow: hidden">${document.beizhu}</textarea>
				</td>
			</tr>
			<tr>
				<input type="hidden" id="user"
					value="${sessionScope.userInfo.name }">
				<input id="supervisionTag" type="hidden" name="supervisionTag">
				<input type="hidden" name="document.supervision"
					value="${document.supervision }">
				<td id="info" style="color: red;" height="10" colspan="8">${document.supervision }</td>
			</tr>
		</table>
		<p></p>
		<div align="center">
			<input type='button' class='button_04'
				onclick="submitNextNode('${flowNode.id}','${flowNode.actorType}')"
				value='${flowNode.name}' />&nbsp; <input type="checkbox" value="1"
				name="message">短信提醒
		</div>
	</form>
</body>
</html>